#pragma once


#include "../qfilemap.h"
using namespace micro::files;


namespace micro
{
namespace qzip
{

	  

class QGzipFile
{

    /* Table of CRCs of all 8-bit messages. */
    uint32		crc_table[256];

    QString		m_filePath;
    QFileMap	m_map;
    LPBYTE		m_pBase;
    LONGLONG	m_fSize;




    //internal data
    QString		m_internalName;
    QString		m_comment;
    time_t		m_time;
    uint16		m_crc16;

    //...
    uint32		m_crc32;
    uint32		m_iSize;


public:
    QGzipFile( void );
    ~QGzipFile( void );

    uint32	ComputeCRC( unsigned char * buf, int len );
    bool	Compress( LPCTSTR source, LPCTSTR target = nullptr, void * progress = nullptr );
    bool	Extract( LPCTSTR path, LPCTSTR target = nullptr, void * progress = nullptr );


private:
    void	make_crc_table( void );
    uint32	update_crc( uint32 crc,  unsigned char * buf, int len );
};

class QZipFile
{
public:
    QZipFile( void );
    ~QZipFile( void );
};

}//
}//

 